package com.zmn.oms.services.interfaces.pay;

import com.zmn.oms.model.dto.work.orderpay.CancelPayDTO;
import com.zmn.oms.model.entity.pay.OrderPay;

import java.util.List;

/**
 * @author ：SongWeidong
 * @date ：2021/3/31 16:51
 * @description：支付明细
 */
public interface OrderPayService {

    /**
     * 通过主键查询
     * @param orderPayId
     * @return
     */
    OrderPay findOrderPayByKey(Long orderId, Long orderPayId);

    /**
     * 通过主键查询
     * @param orderPayId
     * @return
     */
    OrderPay findOrderPayByKeySrcMaster(Long orderId, Long orderPayId);

    List<OrderPay> listOrderPayByOrderIdAndWorkIdAndAmountTypeMasterSrc(Long orderId, Long orderPayId, Integer amountType);

	/**
     * 通过主键查询（包含已删除）
     * @param orderPayId
     * @return
     */
    OrderPay findAllOrderPayByKeySrcMaster(Long orderId, Long orderPayId);

    /**
     * 订单和金额类型数量
     * @param orderId
     * @param workId
     * @param amountType
     * @param tradeType
     * @return
     */
    int countByWorkIdAndAmountType(Long orderId, Long workId, Integer amountType, Integer tradeType);

    /**
     * 查询支付明细数量，包含已删除记录
     * @param orderId
     * @param workId
     * @return
     */
    int countByOrderIdAndWorkIdSrcMaster(Long orderId, Long workId);

	/**
     * 通过orderId查询支付记录
     * @param orderId
     * @return
     */
    List<OrderPay> listOrderPayByOrderId(Long orderId);

    /**
     *  es 同步使用 ~~ 通过orderId集合查询支付记录
     * @param orderIdList
     * @return
     */
    List<OrderPay> listEsOrderPayByOrderIdList(List<Long> orderIdList);

    /**
     * 通过orderId集合查询支付记录
     * @param orderIdList
     * @return
     */
    List<OrderPay> listOrderPayByOrderIdList(List<Long> orderIdList);

    /**
     * 通过orderId，workId查询支付记录，主库
     * @param orderId
     * @return
     */
	List<OrderPay> listOrderPayByOrderIdAndWorkIdMasterSrc(Long orderId, Long workId);

    /**
     * 通过orderId，workId查询支付记录
     * @param orderId
     * @return
     */
    List<OrderPay> listOrderPayByOrderIdAndWorkId(Long orderId, Long workId);

    /**
     * 通过orderId，workId查询支付记录（包含已删除支付记录）
     * @param orderId
     * @return
     */
    List<OrderPay> listAllOrderPayByOrderIdAndWorkId(Long orderId, Long workId);

    List<OrderPay> listOrderPayByOrderIdAndWorkIdsAndTradeTypeSrc(Long orderId, List<Long> workIds, Integer tradeType);

    List<OrderPay> listOrderPayByOrderIdAndWorkIdsAndTradeType(Long orderId, List<Long> workIds, Integer tradeType);

    /**
     * 获取退款交易记录
     * @param orderId
     * @param workId
     * @return
     */
    OrderPay getOrderWorkRefundPay(Long orderId, Long workId);
    /**
     * 保存支付记录
     * @param orderPay
     * @return
     */
    void insertOrderPay(OrderPay orderPay);

    /**
     * 修改支付记录
     * @param orderPay
     * @return
     */
    int updateByPrimaryKeySelective(OrderPay orderPay);

    /**
     * 删除订单和金额类型
     * @param
     * @return
     */
    int deleteByWorkIdAndAmountType(OrderPay orderPay);

    int deleteByKey(OrderPay orderPay);

    int deleteByKeyRecordLog(CancelPayDTO cancelPayDTO);
}
